
Init()

esIni := FileExist(iniPath)
if(esIni) {
    ConfigRead()
} else
{
    InIWriter()
}

F2::
{
    While GetKeyState("F2","P") {
        SendInput "{f}"
        Sleep 100
        SendInput "{e}"
    }
}


F1:: {
	MouseGetPos &MouseX, &MouseY
	color := PixelGetColor(MouseX, MouseY)
    obj.color:=color
    obj.x:=MouseX
    obj.y:=MouseY
	InIWriter()
}


Label() {
   SendInput "{f}"
}

;初始化
Init() {
    global iniPath := "./1.ini"
    global obj := {
        rKey:1000,
        tKey:1000,
        color:"",
        x:0,
        y:0
    }
}

;写入配置文件
InIWriter() {
    IniWrite obj.rkey, iniPath, "ls", "rKey"
    IniWrite obj.tKey, iniPath, "ls", "tKey"
    IniWrite obj.color, iniPath, "ls", "color"
    IniWrite obj.x, iniPath, "ls", "x"
    IniWrite obj.y, iniPath, "ls", "y"
}

;读取配置文件
ConfigRead() {
    obj.rKey := IniRead(iniPath, "ls", "rKey")
    obj.tKey := IniRead(iniPath, "ls", "tKey")
    obj.color := IniRead(iniPath, "ls", "color")
    obj.x := IniRead(iniPath, "ls", "x")
    obj.y := IniRead(iniPath, "ls", "y")
    WriterLog("读取到配置")
}

; 写入日志
WriterLog(name) {
    FileAppend FormatTime() name "：rKey:" obj.rKey " tKey:" obj.tKey " `n", "1.log"
}